FROM ubuntu:16.04

MAINTAINER ole.lee <ole.lee@cdskysoft.com>

RUN apt-get -y update
RUN apt-get -y install ssh
RUN apt-get -y install htop

# create a user.
RUN useradd --create-home --no-log-init btc

# change password for user.
RUN echo "btc:123" | chpasswd

# change login user and working dir.
USER btc
WORKDIR /home/btc

RUN mkdir ~/.bitcoin
RUN echo "rpcuser=test\nrpcpassword=test\n" > ~/.bitcoin/bitcoin.conf

RUN mkdir -p ~/env/bin
RUN mkdir -p ~/env/lib
ENV PATH $PATH:/home/btc/env/bin
ENV LD_LIBRARY_PATH $LD_LIBRARY_PATH:/home/btc/env/lib/


RUN echo "scp -r ole@10.8.5.222:/home/ole/workspace/1_project/blockchain/bchain/src/bitcoin/build/bin/bin/* ~/env/bin/" > ~/env/bin/update_bin.sh
RUN echo "scp -r ole@10.8.5.222:/home/ole/workspace/1_project/blockchain/bchain/src/bitcoin/build/bin/lib_dep/* ~/env/lib" > ~/env/bin/update_lib.sh

RUN chmod 777 ~/env/bin/update_bin.sh
RUN chmod 777 ~/env/bin/update_lib.sh
